package com.timmy.bledemo;

import android.bluetooth.BluetoothDevice;

/**
 * 保存蓝牙设备数据
 */

public class DeviceInfo {

    public BluetoothDevice mDevice;

    public int rssi;

    public DeviceInfo(BluetoothDevice device, int rssi) {
        mDevice = device;
        this.rssi = rssi;
    }

    public BluetoothDevice getDevice() {
        return mDevice;
    }

    public void setDevice(BluetoothDevice device) {
        mDevice = device;
    }

    public int getRssi() {
        return rssi;
    }

    public void setRssi(int rssi) {
        this.rssi = rssi;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        DeviceInfo info = (DeviceInfo) o;

        if (rssi != info.rssi) return false;
        return mDevice !=null ? mDevice.equals(info.mDevice) : info.mDevice == null;

    }

    @Override
    public int hashCode() {
        int result = mDevice != null ? mDevice.hashCode() : 0;
        result = 31 * result + rssi;
        return result;
    }
}
